<script src="../media/system/js/mootools-core.js" type="text/javascript"></script>
<script src="../media/system/js/core.js" type="text/javascript"></script>
<script type="text/javascript" src="../media/system/js/jquery-1.9.1.js"></script>
<script type="text/javascript" src="../media/system/js/jQuery.vietvang.validate.js"></script>
	<script type="text/javascript">
		$(document).ready(function(){
			$('#adminForm').validate({
			});
		});
</script>

<form action="index.php?option=com_activity" method="post" name="adminForm" id="adminForm" class="adminform">
    <table width="100%" border=0 cellspacing="0" cellpadding="0" >
                <tbody>
                    <tr>
                        <td class="text_right" style="width: 9%;"> 都道府県を選択</td>
                        <td style="width: 17%;">
                            <select name="jform[PREF_CODE_SEARCH]" id="jformPREF_CODE" class="ip_small">
                                <option value="0">指定しない</option>
                                <?php 
                                if(isset($this->list_pref)){
                                    foreach($this->list_pref as $value){
                                ?>
                                <option value="<?php echo $value->PREF_CODE; ?>" <?php if($value->PREF_CODE == $this->filter['PREF_CODE_SEARCH']){ echo 'selected="selected"'; } ?>  ><?php echo $value->PREF_NAME; ?></option>
                                <?php 
                                    }
                                }
                                ?>
                            </select>
                        </td>
                        <td class="text_right" style="width: 6%;">オススメ度</td>
                        <td style="width: 17%;">
                            <select name="jform[PEDE_CODE_SEARCH]" 13% id="jformPEDE_CODE" class="tx-small" class="ip_small">
                                <option value="0">指定しない</option>
                            	<?php 
                                    foreach(bgData::getRecommended() as $key=>$item){
                                        ?>
                                        <option value="<?php echo $key; ?>"<?php if ($this->filter['PEDE_CODE_SEARCH'] == $key) { echo ' selected="selected"';} ?>>
                                        <?php echo $item; ?></option>
                                        
                                        <?php 
                                    }
                                 ?>
                            </select>
                        </td>
                        <td class="text_right" style="width: 5%;">施設</td>
                        <td style="width: 12%;line-height: 25.5px; vertical-align: top;" rowspan="5">
                            <table border="0" width="100%">
                                <?php foreach ($this->list_mfac as $key=>$mfac) {
                                ?>
                                    <tr>
                                        <td style="width: 1%;"><input style="float: left" type="checkbox" name="jform[MFACC<?php echo $mfac->MFAC_CODE; ?>]" id="MFACC<?php echo $mfac->MFAC_CODE; ?>" value="<?php echo $mfac->MFAC_CODE; ?>"  <?php if(isset($this->filter['MFACC'.$mfac->MFAC_CODE])) { echo 'checked="checked"'; }  ?> /></td>
                                        <td><label for="MFACC<?php echo $mfac->MFAC_CODE; ?>"><?php echo $mfac->MFAC_NAME; ?></label></td>
                                    </tr>
                                <?php
                                } ?>
                            </table>
                        </td>
                        <td class="text_right" style="width: 5%;">対象</td>
                        <td style="width: 12%;line-height: 25.5px; vertical-align: top;" rowspan="5">
                            <table border="0" width="100%">
                                <?php foreach ($this->list_mobj as $key=>$mobj) {
                                ?>
                                    <tr>
                                        <td style="width: 1%;"><input style="float: left" type="checkbox" name="jform[MOBJJ<?php echo $mobj->MOBJ_CODE; ?>]" id="MOBJJ<?php echo $mobj->MOBJ_CODE; ?>" value="<?php echo $mobj->MOBJ_CODE; ?>"  <?php if(isset($this->filter['MOBJJ'.$mobj->MOBJ_CODE])) { echo 'checked="checked"'; }  ?> /></td>
                                        <td><label for="MOBJJ<?php echo $mobj->MOBJ_CODE; ?>"><?php echo $mobj->MOBJ_NAME; ?></label></td>
                                    </tr>
                                <?php
                                } ?>
                            </table>
                        </td>
                        <td class="text_right" style="width: 5%;">内容</td>
                        <td style="width: 14%;line-height: 25.5px; vertical-align: top;" rowspan="5">
                            <table border="0" width="100%">
                                <?php foreach ($this->list_mcon as $key=>$mcon) {
                                ?>
                                    <tr>
                                        <td style="width: 1%;"><input style="float: left" type="checkbox" name="jform[MCONN<?php echo $mcon->MCON_CODE; ?>]" id="MCONN<?php echo $mcon->MCON_CODE; ?>" value="<?php echo $mcon->MCON_CODE; ?>"  <?php if(isset($this->filter['MCONN'.$mcon->MCON_CODE])) { echo 'checked="checked"'; }  ?> /></td>
                                        <td><label for="MCONN<?php echo $mcon->MCON_CODE; ?>" ><?php echo $mcon->MCON_NAME; ?></label></td>
                                    </tr>
                                <?php
                                } ?>
                            </table>
                        </td>
                    </tr>
                    <tr>
                        <td class="text_right"> 活動名</td>
                        <td><input name="jform[ACTT_NAME_SEARCH]" id="jformACTT_NAME" value="<?php echo $this->filter['ACTT_NAME_SEARCH']; ?>" type="text" value="" class="input medium"/></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                    </tr>
                    <tr style="vertical-align:top">
                        <td class="text_right" style="line-height:30px"> 人数</td>
                        <td>
                            <input style="width:150p" vvName="number" name="jform[ACTT_NUMBER_OF_PARTICIPANTS_1_SEARCH]" id="jformACTT_NUMBER_OF_PARTICIPANTS_1" value="<?php echo $this->filter['ACTT_NUMBER_OF_PARTICIPANTS_1_SEARCH']; ?>" type="text" value="" class="input medium"/>
                             <span name="msg_error"></span>
                        </td>
                        <td style="text-align: center;line-height:30px">～</td>
                        
                        <td style="width:220px">
                            <input vvName="number" name="jform[ACTT_NUMBER_OF_PARTICIPANTS_2_SEARCH]" id="jformACTT_NUMBER_OF_PARTICIPANTS_2" value="<?php echo $this->filter['ACTT_NUMBER_OF_PARTICIPANTS_2_SEARCH']; ?>" type="text" value="" class="input medium"/><label style="line-height:30px">人</label>
                            <span name="msg_error"></span>
                        </td> 
                        <td></td>
                        <td></td>
                        <td></td>
                    </tr>
                    <tr style="vertical-align:top">
                        <td class="text_right" style="line-height:30px"> 期間</td>
                        <td>
                            <?php if($this->filter['FROMDATE_SEARCH'] != 0){ $dt = date('Y-m-d',strtotime($this->filter['FROMDATE_SEARCH']));}else{ $dt=null;} echo JHtml::calendar($dt, 'jform[FROMDATE_SEARCH]', 'jformFROMDATE');?>
                            <span name="msg_error"></span>
                        </td>
                        <td style="text-align: center;line-height:30px">～</td>
                        <td>
                            <?php if($this->filter['TODATE_SEARCH'] != 0){ $dt = date('Y-m-d',strtotime($this->filter['TODATE_SEARCH']));}else{ $dt=null;} echo JHtml::calendar($dt, 'jform[TODATE_SEARCH]', 'jformTODATE');?>
                            <span name="msg_error"></span>
                        </td>
                        <td></td>
                        <td></td>
                        <td></td>
                    </tr>
                    <tr>
                        <td style="vertical-align: top; line-height: 2.5" class="text_right">最終更新日</td>
                        <td style="vertical-align: top;">
                            <?php if($this->filter['FROMUDATE_SEARCH'] != 0){ $dt = date('Y-m-d',strtotime($this->filter['FROMUDATE_SEARCH']));}else{ $dt=null;} echo JHtml::calendar($dt, 'jform[FROMUDATE_SEARCH]', 'jformUDATE');?>
                            <span name="msg_error"></span>
                        </td>
                        <td style="text-align: center; vertical-align: top;line-height:30px">～</td><!-- Chu y ten truong  -->
                        <td style="vertical-align: top;">
                            <?php if($this->filter['TOUDATE_SEARCH'] != 0){ $dt = date('Y-m-d',strtotime($this->filter['TOUDATE_SEARCH']));}else{ $dt=null;} echo JHtml::calendar($dt, 'jform[TOUDATE_SEARCH]', 'jformUDATE1');?>
                            <span name="msg_error"></span>
                        </td>
                        <td></td>
                        <td></td>
                        <td></td>
                    </tr>
                    <tr>
                    
                    <td class="center" colspan="10">
                        <button id="search" type="button" onclick="Joomla.submitbutton('search')">検索</button>
                        <button type="button" name="btnclear" id="btnclear"  onclick="document.id('jformPREF_CODE').value='0';document.id('jformPEDE_CODE').value='0';
                        document.id('jformACTT_NAME').value='';document.id('jformACTT_NUMBER_OF_PARTICIPANTS_1').value='';document.id('jformACTT_NUMBER_OF_PARTICIPANTS_2').value='';
                        document.id('jformFROMDATE').value='';document.id('jformTODATE').value='';document.id('jformUDATE').value='';document.id('jformUDATE1').value='';
                        <?php foreach ($this->list_mfac as $key=>$mfac) {
                        ?>
                            document.id('MFACC<?php echo $mfac->MFAC_CODE; ?>').checked=false;
                        <?php
                        } ?>
                        <?php foreach ($this->list_mobj as $key=>$mobj) {
                        ?>
                            document.id('MOBJJ<?php echo $mobj->MOBJ_CODE; ?>').checked=false;
                        <?php
                        } ?>  
                        <?php foreach ($this->list_mcon as $key=>$mcon) {
                        ?>
                            document.id('MCONN<?php echo $mcon->MCON_CODE; ?>').checked=false;
                        <?php
                        } ?>        
                        Joomla.submitbutton('clear');">クリア</button>
                    </td>

                    </tr>
                </tbody>
                </table>
          
   
    <hr />
   <div class="clr"> </div>

	<table class="adminlist">
		<thead>
			<tr>
                <th width="3%">
					<label class="labelth">選択</label>
                </th>
				<th width="16%">
					<label class="labelth">名称</label><a href="#"></a>				
                </th>
				<!-- <th width="10%">
					<a href="#">都道府県</a>				
                </th> -->
				<th width="14%">
					<label class="labelth">センター・クラブ</label>	
                </th>
				<th width="18%">
					<label class="labelth">期間</label>
                </th>
				<th width="5%">
					<label class="labelth">人数</label>
                </th>
                <th width="14%">
					<label class="labelth">ジャンル</label>
                </th>
                <th width="7%">
					<label class="labelth">オススメ度</label>
                </th>
                <th width="9%">
					<label class="labelth">最終更新日</label>
                </th>
                <th width="8%">
                    <label class="labelth">同期済/未同期</label>
                </th>
                <th width="9%">
                    <label class="labelth">公開/非公開中</label>
                </th>      
                
			</tr>
		</thead>
		<tfoot>
			<tr>
				<td colspan="15">
				    <?php echo $this->pagination->getListFooter(); ?>	
                </td>
			</tr>
		</tfoot>
		<tbody>
        <?php 
            $rows = $this->rows;
            if($rows != null){
                foreach($rows as $k=>$row){
        ?>
		  <tr class="row<?php echo $k%2?>" style="height: 50px;">
			<td class="center"><input type="checkbox" id="cb<?php echo $row->ACTT_CODE; ?>" name="cid[]" value="<?php echo $row->ACTT_CODE; ?>" onclick="Joomla.isChecked(this.checked);"/></td>
			<td class="left"><a href="#" onclick="document.id('cb<?php echo $row->ACTT_CODE; ?>').checked=true;Joomla.submitbutton('edit');"><?php echo $row->ACTT_NAME; ?></a></td>
           <!-- <td class="center"></?//php echo $row->ACTT_EFFECT; ?></td>-->
            <!-- <td class="center"></?php echo $row->PREF_NAME; ?></td> -->
			<td class="left"><?php echo $row->OCBA_NAME; ?></td>            
            <td class="center">
                <?php if($row->ACTT_PERIOD_START != '0000-00-00') { echo HelperBG::F_GetDate_JP($row->ACTT_PERIOD_START); }?>
                <?php if($row->ACTT_PERIOD_START != '0000-00-00' && $row->ACTT_PERIOD_FINISH != '0000-00-00') echo '～';?>
                <?php if($row->ACTT_PERIOD_FINISH != '0000-00-00') { echo HelperBG::F_GetDate_JP($row->ACTT_PERIOD_FINISH); }?>
            </td>
            <td class="center"><?php if($row->ACTT_NUMBER_OF_PARTICIPANTS != 'null') echo $row->ACTT_NUMBER_OF_PARTICIPANTS.'名'; ?></td>
            <td><?php echo $row->LIST_TYPE; ?> </td>
            <?php if($row->ACTT_RECOMMENDED_DEGREE == 1){
                    $star = "★";
                }elseif($row->ACTT_RECOMMENDED_DEGREE == 2){
                    $star = "★★";
                }else{
                    $star = "★★★";
                }
             ?>
            <td class="center"><?php echo $star; ?> </td>
            <td class="center"><?php if($row->ACTT_DATE != '0000-00-00 00:00:00'){ echo HelperBG::F_GetDate_JP($row->ACTT_DATE); } ?> </td>
            <td class="center"><?php if($row->ACTT_DBSY == 1){ echo "同期済"; }else{ echo "未同期"; } ?></td>
            <td class="center"><?php if($row->ACTT_WEBF == 1){ echo "公開済"; }else{ echo "一時保存中"; } ?></td>
            
		  </tr>
        <?php
                }
            }
            else{
                echo "<tr class='row0'>
                            <td colspan='10' class='center'>データは見つかりませんでした</td>
                    </tr>";
            }
        ?>  
		</tbody>
	</table>
	<div>
		<input type="hidden" name="task" value="" />
		<input type="hidden" name="boxchecked" value="0" />
        <!-- <input type="submit" value="同期" style="width: 75px;float:right;" onclick="Joomla.submitbutton('dongbo_csv_actt');document.id('task').value='';"/> -->
</form>

 <script>
         Joomla.submitbutton = function(task){
        	   if(task == 'remove'){
        	       if(!confirm('選択したデータを削除します。よろしいですか？')){
        	           return false;
        	       }
        	   }
               
               Joomla.submitform(task, document.getElementById('adminForm'));
               
         }
          window.addEvent('domready', function() {Calendar.setup({
                	// Id of the input field
                	inputField: "jformFROMDATE",
                	// Format of the input field
                	ifFormat: "%Y/%m/%d",
                	// Trigger for the calendar (button ID)
                	button: "jformDATE",
                	// Alignment (defaults to "Bl")
                	align: "Bl",
                	singleClick: true,
                	firstDay: 0
            	});
            });
          window.addEvent('domready', function() {Calendar.setup({
                	// Id of the input field
                	inputField: "jformTODATE",
                	// Format of the input field
                	ifFormat: "%Y/%m/%d",
                	// Trigger for the calendar (button ID)
                	button: "jformDATE",
                	// Alignment (defaults to "Bl")
                	align: "Bl",
                	singleClick: true,
                	firstDay: 0
            	});
            });
             window.addEvent('domready', function() {Calendar.setup({
                	// Id of the input field
                	inputField: "jformUDATE",
                	// Format of the input field
                	ifFormat: "%Y/%m/%d",
                	// Trigger for the calendar (button ID)
                	button: "jformUDATE",
                	// Alignment (defaults to "Bl")
                	align: "Bl",
                	singleClick: true,
                	firstDay: 0
            	});
            });
            window.addEvent('domready', function() {Calendar.setup({
                	// Id of the input field
                	inputField: "jformUDATE1",
                	// Format of the input field
                	ifFormat: "%Y/%m/%d",
                	// Trigger for the calendar (button ID)
                	button: "jformUDATE1",
                	// Alignment (defaults to "Bl")
                	align: "Bl",
                	singleClick: true,
                	firstDay: 0
            	});
            });
         
</script>